package cn.edu.scau.cmi.zhouxinyue.Adapter;

import java.util.ArrayList;

public class objectAdapter implements SortUtil{
	
	private Adaptee adapter;
	public objectAdapter(Adaptee adapter) {
		this.adapter=adapter;
	}

	@Override
	public void sortInt(ArrayList<Integer> Number) {
		adapter.sortInt(Number);
	}
	
	public void sortStudent(ArrayList<Integer> Number,ArrayList<Student> AllStudent) {
		for(int i=0;i<AllStudent.size()-1;i++) {
			for(int j=i;j<AllStudent.size();j++) {
				if(AllStudent.get(j).getNumber()==Number.get(i)) {
					Student temp=new Student();
					temp.Name(AllStudent.get(i).getName());
					temp.Number(AllStudent.get(i).getNumber());
					AllStudent.get(i).Name(AllStudent.get(j).getName());
					AllStudent.get(i).Number(AllStudent.get(j).getNumber());
					AllStudent.get(j).Name(temp.getName());
					AllStudent.get(j).Number(temp.getNumber());
				}
			}
		}
	}

}
